#include "stdafx.h"
#include "wf_layersadd.h"

#include "pf_graphic.h"



WF_LayersAdd::WF_LayersAdd(PF_Container& container,
                                       PF_GraphicView& graphicView)
        :PF_ActionInterface("Add Layer", container, graphicView) {}


QAction* WF_LayersAdd::createGUIAction(LX_Define::ActionType /*type*/, QObject* /*parent*/) {
    QAction* action = new QAction(tr("Add Layer"), NULL);
    //action->zetStatusTip(tr("Add Layer"));
	action->setIcon(QIcon(":/ui/layeradd.png"));
    return action;
}

void WF_LayersAdd::trigger() {
    PF_DEBUG->print("add layer");

    if (PF_DIALOGFACTORY!=NULL) {
        if (graphic) {
            PF_Layer* layer = PF_DIALOGFACTORY->requestNewLayerDialog(
                                  graphic->getLayerList());
            if (layer!=NULL)
                graphic->addLayer(layer);
        }
    }
    finish();
}



void WF_LayersAdd::init(int status) {
    PF_ActionInterface::init(status);
    trigger();
}

// EOF
